package sweet.helper

import org.apache.commons.lang.{ StringUtils }

/** Container for implicit methods */
object StringHelper{
  implicit def string2helper(s: String) = new StringHelper(s)
}

/** Enhancement to Java String */
class StringHelper(val orig: String) {
  /** Provide a faster split than the {@ String#split}, which uses regex and it's slow!
   * 
   * The implementation is just a wrapper to the Apache's commons-lang StringUtils class.
   * Note that StringUtils.split will split by SINGLE CHAR as Separator, not word!
   */
  def fastSplit(charSep: String) = StringUtils.split(orig, charSep) 
  
  /** Provide a faster replaceAll method.*/
  def fastReplace(from: String, to: String) = StringUtils.replace(orig, from, to)
  
  override def toString = orig
}

